import org.scalatest.FunSuite

import org.junit.runner.RunWith
import org.scalatest.junit.JUnitRunner
import org.scalatest.Suite

@RunWith(classOf[JUnitRunner])
class TestSeqIndexadaBidireccional extends FunSuite {

  test("funca ?") {
    val p = new SeqIndexadaBidireccional[String](".")
    p(20) = "20"
    p(-20) = "-20"
    assert(p(20) == "20")
    assert(p(-20) == "-20")
    assert(p(2) == ".")
  }

  test("indexa bien ?") {
    val p = new SeqIndexadaBidireccional[String](".")
    p(3) = "3"
    p(-2) = "-2"
    val z = p.zipWithIndex
    assert(z.map(t=> t._2).toList == List(-2,-1,0,1,2,3))
    
    assert(p.reduce(_ + _)=="-2....3")
  }
}